const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
    mode: 'development',
    entry: './src/main.js',
    output: {
        path: __dirname + '/dist',
        filename: 'js/[name].js'
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: __dirname + '/index.html',
            title: "手动配置webpack"
        })
    ],
    devServer: {
        port: 5173,
        open: true,
        static: {
            directory: __dirname + '/dist'
        },
        hot: true
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                use: {
                    loader: 'babel-loader',
                    options: {
                        presets: ['@babel/preset-env']
                    }
                }
            }
        ]
    }

}